<template>
	<view class="content">
		<!-- 顶部导航栏 -->
		<view class="top-bar">
			<view class="top-bar-left" @tap="backOne">
				<image src="@/static/images/common/back.png" class="back-img"></image>
			</view>
			<view class="top-bar-center">
				<view class="title">好友请求</view>
			</view>
			<view class="top-bar-right">
				<!-- 占位 -->
				<view class="pice"></view>
			</view>
		</view>
		<view class="main">
			<view class="requester" v-for="(item,index) in requesters" :key="index">
				<view class="request-top">
					<view class="reject btn">拒绝</view>
					<view class="header-img">
						<image :src="item.imgUrl"></image>
					</view>
					<view class="arrange btn">同意</view>
				</view>
				<view class="request-center">
					<view class="title">{{item.name}}</view>
					<view class="time">{{changeTime(item.time)}}</view>
				</view>
				<view class="notic">
					<text>留言：</text>
					{{item.new}}
				</view>
			</view>
			
			
		</view>
	</view>
</template>

<script>
	import datas from "@/commons/js/datas.js"
	import myfun from "@/commons/js/myFun.js"
	export default {
		data() {
			return {
				requesters:[],			//后台好友数据
			}
		},
		onLoad() {
			this.getRequesters();
		},
		methods: {
			//返回上一个页面
			backOne:function(){
				uni.navigateBack({
					delta:1   //返回一层
				});
			},
			//获取时间修改
			changeTime:function(date){
				return myfun.dateTime(date);
			},
			//获取好友
			getRequesters:function(){
				this.requesters = datas.frineds();
				for(let i = 0;i<this.requesters.length;i++)
				{
					this.requesters[i].imgUrl = '../../static/images/img/' + this.requesters[i].imgUrl;
				}
				// console.log(this.requesters);
				// console.log(this.requesters[1].imgUrl)
			},
		}
	}
</script>

<style lang="scss">
@import "../../commons/css/mycss.scss";
.top-bar{
	background: rgba(255,255,255,0.96);
	border-bottom: 1px solid $uni-border-color;
}
.main{
	padding:108rpx $uni-spacing-col-base;
	.requester{
		margin-top: 112rpx;
		padding: $uni-spacing-col-base;
		background-color: rgba(255,255,255,1);
		box-shadow: 0px 24rpx 64rpx -8rpx rgba(0,0,0,0.1);
		border-radius: $uni-border-radius-base;
	}
	.request-top{
		display: flex;
		flex-direction: row;
		.btn{
			flex: none;
			text-align: center;
			width: 160rpx;
			height: 64rpx;
			background: rgba(255,93,91,0.1);
			border-radius: 40rpx;
			font-size: $uni-font-size-lg;
			line-height: 64rpx;
		}
		.reject{
			color: $uni-color-warning;
			background-color: rgba(255,93,91,0.1);
		}
		.arrange{
			color: $uni-text-color;
			background-color: $uni-color-primary;
		}
		.header-img{
			margin-top: -104rpx;
			flex: auto;
			text-align: center;
			image{
				width: 144rpx;
				height: 144rpx;
				border-radius: 50%;
				background-color: $uni-color-primary;
			}
		}
	}
	.request-center{
		text-align: center;
		padding-top: 40rpx;
		padding-bottom: 40rpx;
		.title{
			font-size: 36rpx;
			font-weight: 500;
			color: $uni-text-color;
			line-height: 50rpx;
		}
		.time{
			font-size: $uni-font-size-lg;
			color: $uni-text-color-disable;
			line-height: 34rpx;
		}
	}
	.notic{
		padding: $uni-spacing-row-sm $uni-spacing-col-base;
		border-radius: $uni-border-radius-base;
		background-color: $uni-bg-color-hover;
		font-size: $uni-font-size-base;
		color: $uni-text-color;
		line-height: 40rpx;
	}
}
</style>
